<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Easy chat</title>
        <script src="/socket.io/socket.io.js"></script>
        <style>
            * {
                margin: 0;
                padding: 0;
            }

            body {
                background-image: url("https://www.bing.com/th?id=OHR.SeonamTemple_ZH-CN3460236076_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp");
                background-repeat: no-repeat;
                background-position: center center;
                background-size: cover;
                width: 100vw;
                height: 100vh;
                display: flex;
                justify-content: center;
                align-items: center;
            }

            .window {
                width: 70vw;
                min-width: 620px;
                height: 80vh;
                min-height: 500px;
                background-color: #ffffff8d;
                display: flex;
            }

            .login .left {
                width: 50%;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
                flex-direction: column;
                background-color: #ffffff;
            }

            .login .right {
                width: 50%;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
                flex-direction: column;
                gap: 10px;
            }

            .login .right input {
                width: 300px;
                height: 35px;
                outline: none;
                border: none;
            }

            .login .right input[type="text"],
            .login .right input[type="password"] {
                text-indent: 1em;
            }

            .login .right input[type="submit"] {
                background-color: #eeeeee;
            }

            .login .right input[type="submit"]:hover {
                background-color: #dddddd;
            }

            .chat-box {
                display: grid;
                grid-template-rows: 1fr 0.5fr 40px;
                grid-template-columns: 1fr 200px;
                grid-template-areas: "log list" "input list" "btn list";
            }

            .msg-log-box {
                padding: 15px;
                background-color: #eeeeee;
                grid-area: log;
                overflow: auto;
            }

            .msg-input-box {
                padding: 15px;
                outline: none;
                background-color: #ffffff;
                grid-area: input;
                overflow: auto;
            }

            .msg-sendbtn-box {
                background-color: #ffffff;
                grid-area: btn;
                padding-right: 5px;
            }

            #send {
                height: 35px;
                width: 100px;
                border: none;
                background-color: #12b7f5;
                color: #ffffff;
                float: right;
            }

            #send:hover {
                background-color: #17c1ff;
            }

            .member-list {
                grid-area: list;
            }

            .member-list div {
                background-color: #ffffff9d;
                height: 25px;
                line-height: 25px;
                font-size: 12px;
                color: #999999;
                padding: 0 10px;
            }

            .msg-name {
                font-size: 14px;
                color: #999999;
            }

            .msg-bub {
                display: inline-block;
                background-color: #dddddd;
                padding: 10px;
                margin: 5px 0;
                border-radius: 5px;
                overflow: auto;
                white-space: normal;
                word-wrap: break-word;
                word-break: break-all;
            }

            .msg-self {
                text-align: right;
            }

            .msg-self .msg-name {
                text-align: right;
            }

            .msg-self .msg-bub {
                text-align: left;
                color: #ffffff;
                background-color: #12b7f5;
            }

            .hidden {
                display: none;
            }
        </style>
    </head>

    <body>
        <div class="window login">
            <div class="left">
                <h1>EChat</h1>
                <p>--Easy chat--</p>
            </div>
            <div class="right">
                <h1>Login</h1>
                <br />
                <br />
                <br />
                <input type="text" name="use" placeholder="账号" />
                <input type="password" name="pwd" placeholder="密码" />
                <input type="button" id="loginbtn" value="登录" />
            </div>
        </div>
        <div class="window chat-box hidden">
            <div class="msg-log-box"></div>
            <div class="msg-input-box" contenteditable="true"></div>
            <div class="msg-sendbtn-box">
                <button id="send">发送</button>
            </div>
            <div class="member-list"></div>
        </div>
        <script src="./public/index.js"></script>
    </body>
</html>
